package com.wecheir.service;

import com.wecheir.entity.Role;
import com.wecheir.entity.User;
import com.wecheir.entity.userWithRole.SingleUserWithRole;
import com.wecheir.entity.userWithRole.UserWithRole;
import com.wecheir.utils.ResponseUtils;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

public interface UserService {



    /**
     * 更新用户的信誉度
     * @param user
     */
    void updateUserOnlyCredit(User user);

    /**
     * 通过当前id查询管理的农田主id
     * @param id
     * @return
     */
    String findFarmOwnManagerIdById(String id);

    User findUserByLoginName(String name);

    User findUserById(String id);

    int userCount(String loginName);


    void saveUser(User user);

    void updateUser(User user);

    void deleteUser(User user);

    void lockUser(User user);

    List<User> findAllUser();

    Map<String, Object> getUserList(int start, Integer limit);

    User selectUserByTellOrEmail(@Param("tel")String tel, @Param("email")String email);

    /**
     * 获得所有拥有农田管理员身份的用户
     * @return
     */
    List<User> getAllHaveManagerIdentityUser();
    /**
     * 重置用户信誉度
     * @param user
     * @return
     */
    int resetCredit(User user);

    ResponseUtils checkUser(User userParam, User user);

    List<UserWithRole> getUserWithRole();

    void updateCreditById(String id, double credit) throws Exception;


    List<SingleUserWithRole> getSingleUserWithRole();
}
